import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
// import getWeb3 from '../../util/getWeb'
// import {
// 	Toast
// } from 'vant'
Vue.use(Vuex)

const store = new Vuex.Store({
	state,
	mutations: {
		// registerWeb3Instance(state, payload) {
		// 	let result = payload
		// 	let web3Copy = state.web3
		// 	web3Copy.coinbase = result.coinbase
		// 	web3Copy.networkId = result.networkId
		// 	web3Copy.balance = parseInt(result.balance, 10)
		// 	web3Copy.isInjected = result.injectedWeb3
		// 	web3Copy.web3Instance = result.web3
		// 	state.web3 = web3Copy
		// },
		// changeerror(state, payload) {
		// 	let web3Copy = state.web3
		// 	web3Copy.error = payload
		// }
	},
	actions: {
		// registerWeb3({
		// 	commit
		// }, callback) {
		// 	const toast = Toast.loading({
		// 		message: '加载中...',
		// 		duration: 0
		// 	});
			// getWeb3.then(result => {
				// commit('registerWeb3Instance', result)
				// callback && callback(result)
			// }).catch(e => {
			// 	console.error('注册web3失败', e)
			// 	toast.clear()
			// 	commit('changeerror', e.message)
			// })
		// }
	}
})
export default store;
